package com.two.screen.water.balance.print.bean

import com.two.screen.water.balance.bean.OrderServerBean
import com.two.screen.water.balance.net.api.DataApi
import com.two.screen.water.balance.utils.isNotAvailable

class PrintServerCollectOrderBean {
    var title: String? = null
    var shopName: String? = null
    var startTime: String? = null
    var endTime: String? = null

    var totalPrice: String? = null
    var findZeroPrice: String? = null
    var giftPrice: String? = null
    var realPrice: String? = null
    var orderNumbers: String? = null

    var cashPrice: String? = null
    var miniProgramPrice: String? = null
    var vipPirce: String? = null
    var juhePrice: String? = null
    var scanQrPrice: String? = null

    companion object {
        fun toPrintBean(data: OrderServerBean?): PrintServerCollectOrderBean {

            return PrintServerCollectOrderBean().apply {
                this.title = "销售汇总"

                this.shopName = "商户名称：${DataApi.mShopName}"
                this.startTime = "开始日期：${data?.date?.start?.isNotAvailable()}"
                this.endTime = "结束日期：${data?.date?.end?.isNotAvailable()}"

                this.totalPrice = "应收金额：￥${data?.stat?.r_price}"
                this.findZeroPrice = "找零金额：￥${data?.stat?.di_price}"
                this.giftPrice = "优惠金额：￥${data?.stat?.d_price}"
                this.realPrice = "实收金额：￥${data?.stat?.t_price}"
                this.orderNumbers = "总单数：${data?.count}"

                this.cashPrice = "现金支付实收：￥${data?.actual?.t_price0}"
                this.miniProgramPrice = "小程序支付实收：￥${data?.actual?.t_price4}"
                this.vipPirce = "微会员支付实收：￥${data?.actual?.t_price7}"
                this.juhePrice = "聚合支付实收：￥${data?.actual?.t_price6}"
                this.scanQrPrice = "扫码支付实收：￥${data?.actual?.t_price8}"
            }
        }
    }
}